<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="StudentCreateDlg" widgetVar="StudentCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateStudentTitle}">

            <h:form id="StudentCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{studentController.selected != null}">

                        <p:outputLabel value="#{bundle.CreateStudentLabel_idStudent}" for="idStudent" />
                        <p:inputText id="idStudent" value="#{studentController.selected.idStudent}" title="#{bundle.CreateStudentTitle_idStudent}" required="true" requiredMessage="#{bundle.CreateStudentRequiredMessage_idStudent}"/>

                        <p:outputLabel value="#{bundle.CreateStudentLabel_fullName}" for="fullName" />
                        <p:inputText id="fullName" value="#{studentController.selected.fullName}" title="#{bundle.CreateStudentTitle_fullName}" required="true" requiredMessage="#{bundle.CreateStudentRequiredMessage_fullName}"/>

                        <p:outputLabel value="#{bundle.CreateStudentLabel_status}" for="status" />
                        <p:selectBooleanCheckbox id="status" value="#{studentController.selected.status}" title="#{bundle.EditStudentTitle_status}" required="true" requiredMessage="#{bundle.EditStudentRequiredMessage_status}"/>

                        <p:outputLabel value="#{bundle.CreateStudentLabel_activationDate}" for="activationDate" />
                        <p:calendar id="activationDate" pattern="MM/dd/yyyy HH:mm:ss" value="#{studentController.selected.activationDate}" title="#{bundle.EditStudentTitle_activationDate}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateStudentLabel_userid}" for="userid" />
                        <p:selectOneMenu id="userid" value="#{studentController.selected.userid}" required="true" requiredMessage="#{bundle.EditStudentRequiredMessage_userid}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{userController.items}"
                                           var="useridItem"
                                           itemValue="#{useridItem}"
                                           itemLabel="#{useridItem.id.toString()}"
                                           />
                            <f:converter binding="#{userConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{studentController.saveNew}" value="#{bundle.Save}" update="display,:StudentListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,StudentCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="StudentCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
